<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/12.2.0/markdown-it.min.js"></script>-->
<!--<script src="https://cdn.jsdelivr.net/npm/markdown-it@12.2.0/dist/markdown-it.min.js"></script>-->
<script src="../../node_modules/markdown-it/dist/markdown-it.js"></script>

<div id="markdownbox"></div>
<script>
  // commonmark mode
  // var md = window.markdownit('commonmark')

  // default mode
  // var md = window.markdownit()

  //enable everything
  /*var md = window.markdownit({
    html: true,
    linkify: true,
    typographer: true
  })*/


  // full options list (defaults)
  var md = window.markdownit({
    html:         false,        // Enable HTML tags in source
    /*
      <a>a标签</a>
      ↑↓
      <p>&lt;a&gt;a标签&lt;/a&gt;</p>
    */
    xhtmlOut:     false,        // Use '/' to close single tags (<br />).
                                // This is only for full CommonMark compatibility.

    breaks:       false,        // Convert '\n' in paragraphs into <br>

    langPrefix:   'language-',  // CSS language prefix for fenced blocks. Can be
                                // useful for external highlighters.
    /*
      fenced blocks 是指 markdown里的这种语法:
      ```
      Sample text here...
      ```
    */

    // Enable some language-neutral replacement + quotes beautification
    // For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
    typographer:  false,
    /*
      // Simple typographic replacements
      //
      // (c) (C) → ©
      // (tm) (TM) → ™
      // (r) (R) → ®
      // +- → ±
      // (p) (P) -> §
      // ... → … (also ?.... → ?.., !.... → !..)
      // ???????? → ???, !!!!! → !!!, `,,` → `,`
      // -- → &ndash;, --- → &mdash;
      //

      // TODO:
      // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
      // - miltiplication 2 x 4 -> 2 × 4
    */


    // Double + single quotes replacement pairs, when typographer enabled,
    // and smartquotes on. Could be either a String or an Array.
    //
    // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
    // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
    quotes: '“”‘’',


    // Highlighter function. Should return escaped HTML,
    // or '' if the source string is not changed and should be escaped externally. //没有变化就返回 ''
    // If result starts with <pre... internal wrapper is skipped.
    highlight: function (/*str, lang*/) { return ''; }
  });
  var result = md.render('# markdown-it rulezz!\n<a>a标签</a>\n1/2\n(c)');

  console.log('result:',result);
  markdownbox.innerHTML = result;
</script>
</body>
</html>
